package com.dkd.day20250618;

public class SolutionfindPeakElement {
    public static void main(String[] args) {

    }

    public int findPeakElement (int[] nums) {
        // write code here
        int left = 0, right = nums.length - 1;
        while (left < right) {
            int mid = (right - left) / 2;
            if (nums[mid] > nums[mid + 1]) {
                right = mid;
            }else{
                left=mid+1;
            }
        }
        return right;
    }
}
